package 多线程;

/**
 * 实现Runnable接口
 */
public class myRunnable {

    public static void main(String[] args) throws InterruptedException {
        test2Thread test2Thread = new test2Thread();
        for(int i=0;i<10;i++){
            new Thread(test2Thread).start();
         }
        System.out.println("main....");
    }
}
class test2Thread implements Runnable{
    private int x = 0;
    public void run(){
        for(int i=0;i<10;i++){
            try{
                Thread.sleep(10);
            }catch(Exception e){}
            System.out.println(x++ +" 子线程ID:"+Thread.currentThread().getId());
        }
    }
}